<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/config.inc.php');
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/top.inc.php');


$course_id = mysql_real_escape_string(strip_tags($_POST['id']));
$subject_id = mysql_real_escape_string(strip_tags($_POST['sid']));

$get_subject_data = mysql_query("SELECT * FROM course_subjects WHERE id = $subject_id");
$subject_name = mysql_result($get_subject_data,0,'subject_title');
$abbreviation = mysql_result($get_subject_data,0,'abbreviation');

$get_course_data = mysql_query("SELECT * FROM courses WHERE id='$course_id'");
$course_number=mysql_result($get_course_data,0,"course_number");

echo "<h1>Delete Course for ".stripslashes($subject_name)."</h1>";

$query = "DELETE FROM courses WHERE id='$course_id'";
$result = mysql_query($query);

if ($result)
{
	echo "<b>".stripslashes($abbreviation)." ".stripslashes($course_number)."</b> has been successfully deleted!";
	echo "<br />";
}
else
{
	echo "<b>".stripslashes($abbreviation)." ".stripslashes($course_number)."</b> was NOT able to be deleted at this time!";
	echo "<br />";
}

//close
mysql_close();

echo "<p>";
	echo "<a href='courses.php?id=$subject_id'>&lt;&lt; Back to Courses Portal</a><br />";
echo "</p>";
?>

<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/bottom.inc.php');
?>